package com.xltq.utils;

import com.xltq.service.StudentService;
import com.xltq.service.impl.StudentServiceImpl;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import java.lang.reflect.Method;

public class HUANRAO implements MethodInterceptor {
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        Method method = methodInvocation.getMethod();
        System.out.println("老子可是执行了");
        Object[] arguments = methodInvocation.getArguments();
        String argument = (String) arguments[0];
        if ("李四".equals(argument)){
            System.out.println("老子是天下第一");
        }else {
            System.out.println(argument);
        }
        Object proceed = methodInvocation.proceed();
        return proceed;
    }
}
